#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int p1,p2,p3;
string str0,ret;

bool sh(char x){
	return x >= '0' && x <= '9';
}

bool zi(char x){
	return x >= 'a' && x <= 'z';
}

void add(char le,char ri){
	string t;
	
	for(char ch = le + 1;ch < ri;ch++){
		char tmp = ch;
		
		if(p1 == 2 && zi(ch)) tmp -= 32;
		else if(p1 == 3) tmp = '*';
		
		for(int i = 0;i < p2;i++){
			t += tmp;
		}
	}
	if(p3 == 2) reverse(t.begin(),t.end());
	ret += t;
}

int main(){
	cin >> p1 >> p2 >> p3;
	cin >> str0;
	
	int n = str0.size();
	
	for(int i = 0;i < n;i++){
		char ch = str0[i];
		if(ch != '-' || i == 0||i == n - 1) ret += ch;
		else{
			char le = str0[i - 1],ri = str0[i + 1];
			if(sh(le) && sh(ri) && ri > le || zi(le) && zi(ri) && ri > le){
				add(le,ri);
			}
			else{
				ret += ch;
			}
		}
	}
	cout << ret << endl;
	return 0;
}
